package com.boyu.service;

import com.boyu.common.model.Article;
import com.jfinal.plugin.activerecord.Page;

import java.util.List;

/**
 * Created by legend9999 on 2017/6/18.
 */
public class ArticleService {
	public Article get(int id) {
		Article article = Article.dao.findById(id);
		return article;
	}

	public Page<Article> getPage(int columnId, int pageNum) {
		Page<Article> articlePage = Article.dao.paginate(pageNum, 20, "select *", "from t_article where columnId=" + columnId + " order by id asc");
		return articlePage;
	}

	public List<Article> getTitleList(int columnId) {
		List<Article> articles = Article.dao.find("select * from t_article where columnId=? limit 5", columnId);
		return articles;
	}
}
